/*******************************************************************************
*  file    : dataobject.hpp
*  created : 07.08.2014
*  author  : Slyshyk Oleksiy (alexSlyshyk@gmail.com)
*******************************************************************************/

#ifndef DATAOBJECT_HPP
#define DATAOBJECT_HPP

#include <QObject>
#include <QVector>
#include <complex>
#include <QDateTime>
#include <QSharedPointer>
#include <QJsonDocument>

struct NamedData;

class DataObject : public QObject
{
    Q_OBJECT
public:
    explicit DataObject(QObject *parent = 0);

    double sampleRate   () const;
    void   setSampleRate(double sampleRate);

    void setDataL(QSharedPointer<NamedData> data);
    void setDataL(const std::vector<std::complex<double> > &data);

    QSharedPointer<NamedData> dataL() ;
    QSharedPointer<NamedData> dataR() ;
    QWeakPointer<NamedData> dataL() const;
    QWeakPointer<NamedData> dataR() const;
    void setDataR(QSharedPointer<NamedData> data);
    void setDataR(const std::vector<std::complex<double> > &data);

    QString description() const;
    void setDescription(const QString &description);

    QDateTime time() const;
    void setTime(const QDateTime &time);

    double temperature() const;
    void setTemperature(double temperature);

    double pressure() const;
    void setPressure(double pressure);

    QJsonDocument toJsonDocument() const;
    void          updateFromJson(const QJsonDocument& document);
private:
    double          temperature_  = 0.;
    double          pressure_     = 0.;
    QString         description_;
    QDateTime       time_;

    QSharedPointer<NamedData> dataL_;
    QSharedPointer<NamedData> dataR_;
};

#endif // DATAOBJECT_HPP
